import requests
from lxml import etree


headers = {
    'user-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'
}
url = 'https://www.pearvideo.com/category_5'
page_text = requests.get(url=url, headers=headers).text


tree = etree.HTML(page_text)
li_list = tree.xpath('//ul[@id="listvideoListUl"]/li')
for li in li_list:
    detail_url = 'https://www.pearvideo.com/'+li.xpath('./div/a/@href')[0]
    name = li.xpath('./div/a/div[2]/text()')[0]+'.mp4'
    #对详情页发请求
    detail_page_text = requests.get(url=detail_url,headers=headers).text
    #从详情也中解析处视频的地址（url）


#最终教程里的网站模式相对新版已经落后，无法爬取。
